package com.wmlive.hhvideo.heihei.personal.adapter;

import android.view.ViewGroup;
import cn.wmlive.hhvideo.R;
import com.wmlive.hhvideo.heihei.beans.main.ShortVideoItem;
import com.wmlive.hhvideo.utils.imageloader.GlideLoader;
import com.wmlive.hhvideo.widget.refreshrecycler.RefreshAdapter;
import com.wmlive.hhvideo.widget.refreshrecycler.RefreshRecyclerView;

import java.util.List;

/**
 * Created by XueFei on 2017/5/27.
 */

public class OtherHomeProductAdapter extends RefreshAdapter<PersonalProductHolder, ShortVideoItem> {
    public OtherHomeProductAdapter(List<ShortVideoItem> list, RefreshRecyclerView refreshView) {
        super(list, refreshView);
    }

//    @Override
//    public void onAttachedToRecyclerView(RecyclerView recyclerView) {
//        super.onAttachedToRecyclerView(recyclerView);
//        RecyclerView.LayoutManager manager = recyclerView.getLayoutManager();
//        if (manager instanceof GridLayoutManager) {
//            final GridLayoutManager gridManager = ((GridLayoutManager) manager);
//            gridManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
//                @Override
//                public int getSpanSize(int position) {
//                    int type = getItemViewType(position);
//                    switch (type) {
////                        case 3:
////                        case 2:
////                            return 3;
//                        default:
//                            return 1;
//                    }
//                }
//            });
//        }
//    }

    @Override
    public PersonalProductHolder onCreateHolder(ViewGroup parent, int viewType) {
        return new PersonalProductHolder(parent, R.layout.fragment_personal_video_item);
    }

    @Override
    public void onBindHolder(PersonalProductHolder holder, int position, ShortVideoItem data) {
        GlideLoader.loadImage(data.getOpus_small_cover(), holder.ivBg, R.drawable.bg_video_default_16_9);
        holder.tvCount.setText(String.valueOf(data.getLike_count()));
    }
}
